/*
 * Generated file. 
 * 
 * MyDocumentsView.java
 */
package xsp;

import com.ibm.xsp.page.compiled.AbstractCompiledPage;
import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.ibm.xsp.page.compiled.NoSuchComponentException;
import com.ibm.xsp.page.compiled.PageExpressionEvaluator;
import java.lang.String;
import java.lang.Object;
import java.lang.Integer;
import com.ibm.xsp.component.UIViewRootEx2;
import java.lang.Boolean;
import com.ibm.xsp.extlib.component.mobile.UIDMHeading;
import javax.faces.el.ValueBinding;
import com.ibm.xsp.component.UIPanelEx;
import com.ibm.xsp.extlib.component.mobile.UIToolBarButton;
import com.ibm.xsp.component.xp.XspEventHandler;
import com.ibm.xsp.extlib.actions.MoveToAction;
import com.ibm.xsp.component.UIIncludeComposite;
import com.ibm.xsp.binding.PropertyMap;
import com.ibm.xsp.extlib.component.data.UIDataView;
import com.ibm.xsp.model.domino.DominoViewData;
import com.ibm.xsp.extlib.component.data.ExtraColumn;
import com.ibm.xsp.convert.DateTimeConverter;
import com.ibm.xsp.extlib.component.data.IconColumn;
import com.ibm.xsp.extlib.component.image.IconEntry;
import com.ibm.xsp.extlib.component.data.SummaryColumn;
import com.ibm.xsp.extlib.component.data.UIPagerSizes;
import com.ibm.xsp.component.xp.XspLineBreak;
import com.ibm.xsp.component.xp.XspDiv;
import com.ibm.xsp.component.xp.XspOutputLabel;
import com.ibm.xsp.component.xp.XspPager;
import com.ibm.xsp.component.xp.XspOutputLink;
import com.ibm.xsp.extlib.actions.client.data.DataIteratorAddRows;

@SuppressWarnings("all")
public class MyDocumentsView extends AbstractCompiledPageDispatcher{

    private static final String[][] s_libraryVersions = new String[][]{
        {"com.ibm.xsp.extlib.library", "8.5.32006"},  // version of "xe:toolBarButton"
    };
    
    public MyDocumentsView() {
        super("8.5.2"); // version of xe:dataView binding
    }

    protected String[][] getLibraryTagVersions() {
        return s_libraryVersions;
    }

    protected AbstractCompiledPage createPage(int pageIndex) {
        return new MyDocumentsViewPage();
    }
    
    protected boolean isCustomControl() {
        return true;
    }

    public static class MyDocumentsViewPage extends AbstractCompiledPage {
        
        private static final ComponentInfo[] s_infos = new ComponentInfo[]{
            ComponentInfo.EMPTY_NORMAL, // 0 eventHandler
            new ComponentInfo(false, new int[]{0}), // 1 "button1"
            new ComponentInfo(false, new int[]{1}), // 2 panel
            new ComponentInfo(false, null, // 3 "djxmheading5"
              new Object[][]{
                new Object[]{"actionFacet", Integer.valueOf(2)},
              } ),
            ComponentInfo.EMPTY_NORMAL, // 4 mobileSearch
            ComponentInfo.EMPTY_NORMAL, // 5 "pagersizes1"
            new ComponentInfo(false, new int[]{5}), // 6 "panel3"
            ComponentInfo.EMPTY_NORMAL, // 7 br
            ComponentInfo.EMPTY_NORMAL, // 8 label
            new ComponentInfo(false, new int[]{8}), // 9 div
            new ComponentInfo(false, new int[]{7, 9}), // 10 panel2
            ComponentInfo.EMPTY_NORMAL, // 11 "pager3"
            new ComponentInfo(false, new int[]{11}), // 12 panel4
            ComponentInfo.EMPTY_NORMAL, // 13 eventHandler2
            new ComponentInfo(false, new int[]{13}), // 14 "link6"
            ComponentInfo.EMPTY_NORMAL, // 15 "pager1"
            new ComponentInfo(false, new int[]{15}), // 16 panel5
            new ComponentInfo(false, null, // 17 "dataview5"
              new Object[][]{
                new Object[]{"pagerBottomLeft", Integer.valueOf(6)},
                new Object[]{"noRows", Integer.valueOf(10)},
                new Object[]{"pagerTopRight", Integer.valueOf(12)},
                new Object[]{"pagerBottom", Integer.valueOf(14)},
                new Object[]{"pagerBottomRight", Integer.valueOf(16)},
              } ),
            new ComponentInfo(false, new int[]{3, 4, 17}), // 18 view
        };
        
        public MyDocumentsViewPage() {
            super(18, s_infos );
        }
        
        public int getComponentForId(String id) throws NoSuchComponentException { 
            if( "djxmheading5".equals(id) )
                return 3;
            if( "button1".equals(id) )
                return 1;
            if( "dataview5".equals(id) )
                return 17;
            if( "panel3".equals(id) )
                return 6;
            if( "pagersizes1".equals(id) )
                return 5;
            if( "pager3".equals(id) )
                return 11;
            if( "link6".equals(id) )
                return 14;
            if( "pager1".equals(id) )
                return 15;
            return -1;
        }
        
        public UIComponent createComponent(int id, FacesContext context,
                UIComponent parent, PageExpressionEvaluator evaluator)
                throws NoSuchComponentException { 
            switch (id) {
            case 18:
                return createView(context, parent, evaluator);
            case 3:
                return createDjxmheading5(context, parent, evaluator);
            case 2:
                return createPanel(context, parent, evaluator);
            case 1:
                return createButton1(context, parent, evaluator);
            case 0:
                return createEventHandler(context, parent, evaluator);
            case 4:
                return createMobileSearch(context, parent, evaluator);
            case 17:
                return createDataview5(context, parent, evaluator);
            case 6:
                return createPanel3(context, parent, evaluator);
            case 5:
                return createPagersizes1(context, parent, evaluator);
            case 10:
                return createPanel2(context, parent, evaluator);
            case 7:
                return createBr(context, parent, evaluator);
            case 9:
                return createDiv(context, parent, evaluator);
            case 8:
                return createLabel(context, parent, evaluator);
            case 12:
                return createPanel4(context, parent, evaluator);
            case 11:
                return createPager3(context, parent, evaluator);
            case 14:
                return createLink6(context, parent, evaluator);
            case 13:
                return createEventHandler2(context, parent, evaluator);
            case 16:
                return createPanel5(context, parent, evaluator);
            case 15:
                return createPager1(context, parent, evaluator);
            }
            throw new NoSuchComponentException(id);
        }
        
        private UIComponent createView(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIViewRootEx2 result = new UIViewRootEx2();
            initViewRoot(result);
            return result;
        }

        private UIComponent createDjxmheading5(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:isMobile()}";
            String sourceId = "djxmHeading5/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIDMHeading result = new UIDMHeading();
            result.setLabel("My Documents");
            String sourceId2 = "djxmHeading5/xp:this.rendered[1]/text()";
            String renderedExpr = "#{javascript:\n\t\t\t\tsessionScope.from = \"myDocs\";\n\t\t\t\treturn true;\n\t\t\t}";
            ValueBinding rendered = evaluator.createValueBinding(result, renderedExpr, sourceId2,boolean.class);
            result.setValueBinding("rendered", rendered);
            result.setBack("Back");
            setId(result, "djxmHeading5");
            result.setMoveTo("home");
            return result;
        }

        private UIComponent createPanel(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            String sourceId = "djxmHeading5/xp:this.facets[1]/xp:panel[1]/xp:this.rendered[1]/text()";
            String renderedExpr = "#{javascript:userBean.canCreateDocs}";
            ValueBinding rendered = evaluator.createValueBinding(result, renderedExpr, sourceId,boolean.class);
            result.setValueBinding("rendered", rendered);
            return result;
        }

        private UIComponent createButton1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIToolBarButton result = new UIToolBarButton();
            result.setStyle("font-size:22px;");
            result.setLabel("+");
            setId(result, "button1");
            return result;
        }

        private UIComponent createEventHandler(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspEventHandler result = new XspEventHandler();
            MoveToAction action = new MoveToAction();
            action.setComponent(result);
            action.setTargetPage("newTopic");
            action.setForceFullRefresh(true);
            action.setTransitionType("slide");
            action.setDirection("Left to Right");
            action.setSourceReferenceId("button1/xp:eventHandler[1]/xp:this.action[1]/xe:moveTo[1]");
            result.setAction(action);
            result.setSubmit(true);
            result.setEvent("onclick");
            result.setRefreshMode("complete");
            return result;
        }

        private UIComponent createMobileSearch(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:isMobile()}";
            String sourceId = "/xp:view[1]/xc:mobileSearch[1]/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            String resultPage = "/mobileSearch.xsp";
            UIIncludeComposite result = new UIIncludeComposite();
            result.setPageDriver(getPageParam().getPageDriver());
            result.setPageName(resultPage);
            String sourceId2 = "/xp:view[1]/xc:mobileSearch[1]/xp:this.rendered[1]/text()";
            String renderedExpr = "#{javascript:// only show the search panel if the db is full text indexed\n\t\t\treturn database.isFTIndexed();\n\t\t}";
            ValueBinding rendered = evaluator.createValueBinding(result, renderedExpr, sourceId2,boolean.class);
            result.setValueBinding("rendered", rendered);
            PropertyMap propertyMap = result.getPropertyMap();
            propertyMap.setProperty("dataView", "dataView5");
            return result;
        }

        private UIComponent createDataview5(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            String bindingExpr = "#{viewStateBean.dataIterator}";
            ValueBinding binding = evaluator.createValueBinding(null, bindingExpr, null, UIComponent.class);
            Object bound = binding.getValue(context);
            if( binding.isReadOnly(context) ){
                binding = null;
            }
            if( bound instanceof UIComponent ){
                UIComponent computedResult = (UIComponent) bound;
                if( null != binding ){
                    initBindingProperty(context, binding, computedResult);
                }
                return computedResult;
            }
            UIDataView result = new UIDataView();
            result.setOpenDocAsReadonly(true);
            result.setCollapsibleRows(true);
            result.setVar("viewEntry");
            DominoViewData data = new DominoViewData();
            data.setComponent(result);
            data.setViewName("xpByAuthor");
            String sourceId = "dataView5/xe:this.data[1]/xp:dominoView[1]/@categoryFilter";
            String categoryFilterExpr = "#{javascript:userBean.abbreviatedName}";
            ValueBinding categoryFilter = evaluator.createValueBinding(result, categoryFilterExpr, sourceId,String.class);
            data.setValueBinding("categoryFilter", categoryFilter);
            data.setVar("dominoView");
            String sourceId2 = "dataView5/xe:this.data[1]/xp:dominoView[1]/@search";
            String searchExpr = "#{requestScope.searchQuery}";
            ValueBinding search = evaluator.createValueBinding(result, searchExpr, sourceId2,String.class);
            data.setValueBinding("search", search);
            data.setDataCache("full");
            result.setData(data);
            ExtraColumn extraColumns = new ExtraColumn();
            extraColumns.setComponent(result);
            DateTimeConverter converter = new DateTimeConverter();
            converter.setDateStyle("short");
            converter.setTimeStyle("short");
            converter.setType("both");
            extraColumns.setConverter(converter);
            extraColumns.setColumnName("Date");
            extraColumns.setColumnTitle("Date");
            String sourceId3 = "dataView5/xe:this.extraColumns[1]/xe:viewExtraColumn[1]/xp:this.styleClass[1]/text()";
            String styleClassExpr = "#{javascript:\n\t\t\t\t\tif(isMobile())\n\t\t\t\t\t\treturn \"xlExtraColumn\";\n\t\t\t\t}";
            ValueBinding styleClass = evaluator.createValueBinding(result, styleClassExpr, sourceId3,String.class);
            extraColumns.setValueBinding("styleClass", styleClass);
            result.addExtraColumn(extraColumns);
            IconColumn iconColumn = new IconColumn();
            iconColumn.setComponent(result);
            IconEntry icons = new IconEntry();
            icons.setComponent(result);
            String sourceId4 = "dataView5/xe:this.iconColumn[1]/xe:viewIconColumn[1]/xe:this.icons[1]/xe:iconEntry[1]/xp:this.alt[1]/text()";
            String altExpr = "#{javascript:\n\t\t\t\t\t\t\tvar level=viewEntry.getIndentLevel();\n\t\t\t\t\t\t\tif (viewEntry.getRead(userBean.canonicalName) && level == 0)\n\t\t\t\t\t\t\t\t{return res.getString(\"images.alt.main.read\");}\n\t\t\t\t\t\t\telse if(!viewEntry.getRead(userBean.canonicalName) && level == 0)\n\t\t\t\t\t\t\t\t{return res.getString(\"images.alt.main.unread\");}\n\t\t\t\t\t\t\telse if(viewEntry.getRead(userBean.canonicalName) && level > 0)\n\t\t\t\t\t\t\t\t{return res.getString(\"images.alt.repsone.read\");}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{return res.getString(\"images.alt.repsone.unread\");}\n\t\t\t\t\t\t}";
            ValueBinding alt = evaluator.createValueBinding(result, altExpr, sourceId4,String.class);
            icons.setValueBinding("alt", alt);
            String sourceId5 = "dataView5/xe:this.iconColumn[1]/xe:viewIconColumn[1]/xe:this.icons[1]/xe:iconEntry[1]/xp:this.url[1]/text()";
            String urlExpr = "#{javascript:\n\t\t\t\t\t\t\tvar level=viewEntry.getIndentLevel();\n\t\t\t\t\t\t\tvar isResponse = viewEntry.getDocument().isResponse();\n\t\t\t\t\t\t\tif (viewEntry.getRead(userBean.canonicalName) && !isResponse)\n\t\t\t\t\t\t\t\t{return \"xpPostRead.gif\";}\n\t\t\t\t\t\t\telse if(!viewEntry.getRead(userBean.canonicalName) && !isResponse)\n\t\t\t\t\t\t\t\t{return \"xpPostUnread.gif\";}\n\t\t\t\t\t\t\telse if(viewEntry.getRead(userBean.canonicalName) && isResponse)\n\t\t\t\t\t\t\t\t{return \"xpResponseRead.gif\";}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{return \"xpResponseUnread.gif\";}\n\t\t\t\t\t\t}";
            ValueBinding url = evaluator.createValueBinding(result, urlExpr, sourceId5,String.class);
            icons.setValueBinding("url", url);
            iconColumn.addIcon(icons);
            result.setIconColumn(iconColumn);
            result.setColumnTitles(true);
            String sourceId6 = "dataView5/xp:this.rows[1]/text()";
            String rowsExpr = "#{javascript:\n\t\t\tif(isMobile())\n\t\t\t{\n\t\t\t\treturn \"10\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn \"25\";\n\t\t\t}\n\t\t}";
            ValueBinding rows = evaluator.createValueBinding(result, rowsExpr, sourceId6,int.class);
            result.setValueBinding("rows", rows);
            String sourceId7 = "dataView5/xp:this.pageName[1]/text()";
            String pageNameExpr = "#{javascript:\n\t\t\t\tif(isMobile())\n\t\t\t\t{\n\t\t\t\t\treturn \"document\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn \"topicThread.xsp\";\n\t\t\t\t}\n\t\t\t}";
            ValueBinding pageName = evaluator.createValueBinding(result, pageNameExpr, sourceId7,String.class);
            result.setValueBinding("pageName", pageName);
            result.setCollapsibleDetail(true);
            setId(result, "dataView5");
            SummaryColumn summaryColumn = new SummaryColumn();
            summaryColumn.setComponent(result);
            String sourceId8 = "dataView5/xe:this.summaryColumn[1]/xe:viewSummaryColumn[1]/xe:this.value[1]/text()";
            String valueExpr = "#{javascript:\n\t\t\t\t\tvar doc = viewEntry.getDocument();\n\t\t\t\t\tvar readers = doc.getItemValueString(\"readers\") != \"\";\n\t\t\t\t\tvar expire = doc.getItemValueString(\"expire\") != \"\";\n\t\t\t\t\t\n\t\t\t\t\tvar prefix = \"\";\n\t\t\t\t\tif(readers)\n\t\t\t\t\t{\n\t\t\t\t\t\tprefix = res.getString(\"private\");\n\t\t\t\t\t}\n\t\t\t\t\telse if(expire)\n\t\t\t\t\t{\n\t\t\t\t\t\tprefix = res.getString(\"expired\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(viewEntry.getColumnValue(\"Form\") == \"Response\")\n\t\t\t\t\t{\n\t\t\t\t\t\tvar t =  prefix + viewEntry.getColumnValue(\"Topic\") + \" (\"+res.getString(\"byauthor.re\")+\": \" + viewEntry.getColumnValue(\"OriginalSubject\") + \")\";\n\t\t\t\t\t\treturn t;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn prefix + viewEntry.getColumnValue(\"Topic\");\n\t\t\t\t\t}\n\t\t\t\t}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId8,Object.class);
            summaryColumn.setValueBinding("value", value);
            summaryColumn.setColumnTitle("Topic");
            result.setSummaryColumn(summaryColumn);
            if (null != binding) {
                initBindingProperty(context, binding, result);
            }
            return result;
        }

        private UIComponent createPanel3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:!isMobile()}";
            String sourceId = "panel3/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIPanelEx result = new UIPanelEx();
            setId(result, "panel3");
            return result;
        }

        private UIComponent createPagersizes1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPagerSizes result = new UIPagerSizes();
            result.setSizes("5|10|25|50|100");
            setId(result, "pagerSizes1");
            return result;
        }

        private UIComponent createPanel2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            return result;
        }

        private UIComponent createBr(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspLineBreak result = new XspLineBreak();
            return result;
        }

        private UIComponent createDiv(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspDiv result = new XspDiv();
            result.setStyleClass("xlEmptyFacet");
            return result;
        }

        private UIComponent createLabel(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspOutputLabel result = new XspOutputLabel();
            String sourceId = "dataView5/xp:this.facets[1]/xp:panel[4]/xp:div[1]/xp:label[1]/@value";
            String valueExpr = "#{javascript: res.getString(\'no_documents_found\')}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            return result;
        }

        private UIComponent createPanel4(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:!isMobile()}";
            String sourceId = "dataView5/xp:this.facets[1]/xp:panel[1]/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIPanelEx result = new UIPanelEx();
            result.setStyleClass("panelPagerTopRight");
            return result;
        }

        private UIComponent createPager3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspPager result = new XspPager();
            result.setStyleClass("pager");
            result.setFor("dataView5");
            result.setPartialRefresh(true);
            result.setLayout("Previous Group Next");
            setId(result, "pager3");
            return result;
        }

        private UIComponent createLink6(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:isMobile()}";
            String sourceId = "link6/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLink result = new XspOutputLink();
            result.setEscape(true);
            String sourceId2 = "link6/xp:this.rendered[1]/text()";
            String renderedExpr = "#{javascript:\n\t\t\t\t\t\tvar dv = getComponent(\"dataView5\");\n\t\t\t\t\t\treturn(null != dv && dv.getRowCount() > 10);\n\t\t\t\t\t}";
            ValueBinding rendered = evaluator.createValueBinding(result, renderedExpr, sourceId2,boolean.class);
            result.setValueBinding("rendered", rendered);
            setId(result, "link6");
            result.setText("More...");
            return result;
        }

        private UIComponent createEventHandler2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspEventHandler result = new XspEventHandler();
            result.setSubmit(false);
            result.setEvent("onclick");
            DataIteratorAddRows script = new DataIteratorAddRows();
            script.setComponent(result);
            script.setDisableId("link6");
            script.setRowCount(5);
            script.setFor("dataView5");
            script.setSourceReferenceId("link6/xp:eventHandler[1]/xp:this.script[1]/xe:addRows[1]");
            result.setScript(script);
            return result;
        }

        private UIComponent createPanel5(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:!isMobile()}";
            String sourceId = "dataView5/xp:this.facets[1]/xp:panel[3]/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIPanelEx result = new UIPanelEx();
            return result;
        }

        private UIComponent createPager1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspPager result = new XspPager();
            result.setStyleClass("pager");
            result.setFor("dataView5");
            result.setPartialRefresh(true);
            result.setLayout("Previous Group Next");
            setId(result, "pager1");
            return result;
        }

    }
}
